import { createRouter, createWebHashHistory } from "vue-router";

const routes = [
  {
    path: "/",
    redirect: "/home",
  },

  {
    path: "/home",
    name: "Home",
    component: () => import("../views/Home.vue"),
    redirect: "/home/firstpage",
    children: [
      {
        path: "/home/firstpage",
        component: () => import("../components/home/FirstPage"),
        meta:{title:'鲸游首页'}
      },
      {
        path: "/home/community",
        component: () => import("../components/home/Community"),
        meta:{title:'鲸游社区'}
      },
      {
        path: "/home/journey",
        component: () => import("../components/home/Journey"),
        meta:{title:'鲸游行程'}
      },
      {
        path: "/home/message",
        component: () => import("../components/home/Message"),
        meta:{title:'消息'}
      },
      {
        path: "/home/mine",
        component: () => import("../components/home/Mine"),
        meta:{title:'个人中心'}
      },
    ],
  },
  {
    path: "/camera",
    name: "Camera",
    component: () => import("../views/Camera.vue"),
    meta:{title:'鲸游相机'}
  },
  {
    path: "/hotel",
    name: "Hotel",
    component: () => import("../views/Hotel.vue"),
    meta:{title:'鲸游住宿'}
  },
  {
    path: "/takePhotos",
    name: "TakePhotos",
    component: () => import("../views/TakePhotos.vue"),
    meta:{title:'美颜拍照'}
  },
  {
    path: "/travel",
    name: "Travel",
    component: () => import("../views/Travel.vue"),
    meta:{title:'鲸游去旅游'}
  },
  //城市路由
  {
    path: "/city",
    name: "City",
    component: () => import("../views/City.vue"),
    meta:{title:'选择城市'}
  },

  {
    path: "/trip/airplane",
    name: "Airplane",
    component: () => import("../components/trip/Airplane.vue"),
    meta:{title:'鲸游出行-飞机'}
  },
  {
    path: "/trip/ship",
    name: "Ship",
    component: () => import("../components/trip/Ship.vue"),
    meta:{title:'鲸游出行-车/船'}
  },
  {
    path: "/trip/taxi",
    name: "Taxi",
    component: () => import("../components/trip/Taxi.vue"),
    meta:{title:'鲸游出行-taxi'}
  },
  {
    path: "/trip/train",
    name: "Train",
    component: () => import("../components/trip/Train.vue"),
    meta:{title:'鲸游出行-高铁'}
  },

  {
    path: "/404",
    name: "404",
    component: () => import("../views/NotFount"),
    meta:{title:'NotFount-404'}
  },
  {
    path: "/:pathMatch(.*)",
    redirect: "/404",
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});
router.afterEach((to) => {
  document.title=to.meta.title
})
export default router;
